local common = require "common"
local util = require "util"
local global = require "global"

PlayerMgrHelper = {}

function PlayerMgrHelper.kickOutPlayer(session, reason)
    local connect_server  = global.connect_server

    local req_msg_ws = {client_uid = session:get_client_uid(), pid = session:get_pid(), reason = reason}
    session:SendToWS(cs2ws.ReqRemovePlayer, req_msg_ws)
    
    local req_msg_ms = {client_uid = session:get_client_uid(), pid = session:get_pid(), reason = reason}
    session:SendToMS(cs2ms.ReqRemovePlayer, req_msg_ms)

    local req_msg_csm = {account_idx = session:get_account_idx(), pid = session:get_pid(), reason = reason}
    connect_server:SendToCSM(cs2csm.ReqLogoutGame, req_msg_csm)

    global.client_session_mgr:CleanupSession(session:get_conn_idx())
    session:Disconnect()
end

return PlayerMgrHelper